package org.br.erp.rfq.xbj.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.br.erp.rfq.xbj.entity.Scmxjd;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.br.erp.rfq.xbj.vo.ScmVendorUnQuoList;
import org.br.erp.rfq.xbj.vo.ScmxjdVo;

/**
 * @Description: 询价单
 * @Author: jeecg-boot
 * @Date:   2023-09-16
 * @Version: V1.0
 */
public interface ScmxjdMapper extends BaseMapper<Scmxjd> {

    @Select("SELECT  head.id as xjdid,item.id as xjditemid , item.matcode ,item.matname ,item.count as matcount,substring_index( substring_index( item.quality , ',', b.help_topic_id + 1 ), ',',- 1 ) as matquality,concat(head.id,'&',item.id,'&',substring_index( substring_index( item.quality , ',', b.help_topic_id + 1 ), ',',- 1 ))  as itemid,head.partcount as sumcount,head.plate ,head.vin ,head.vehicle ,head.licenseimage ,head.accidentimages \n" +
            "FROM\n" +
            "              scmxjditem  item\n" +
            "            left join scmxjd head on head.id =item.parentid \n" +
            "              JOIN mysql.help_topic b ON b.help_topic_id < ( length( item.quality  ) - length( REPLACE ( item.quality , ',', '' ) ) + 1) "+
            "   ${ew.customSqlSegment}  ")
    public List<ScmVendorUnQuoList> getVendorUnQuoList(@Param("page")IPage<ScmVendorUnQuoList> page, @Param(Constants.WRAPPER) QueryWrapper<ScmVendorUnQuoList> queryWrapper);

}
